home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / bbs / cuser125.zip / COOLUSER.MEX < prev    next >
Text File  |  1997-07-12  |  12KB  |  478 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // CoolUser V1.25 (C)1996-1997 by Neil Staib
  4. //
  5. // MEX: Copywrite 1990, 1995 by Lanius Corporation. All Rights reserved.
  6. //
  7. //////////////////////////////////////////////////////////////////////////////
  8. #include <max.mh>                                                                                                                                                        include <max.mh>                                                           //
  9. #include <intpad.mh>
  10. #define INCL_global
  11. #define INCL_cooluser
  12. #include <language.mh>
  13. #include <cooluser.mh>
  14.  
  15. void writeinkey(string: inkey);
  16.  
  17. void main()
  18. {
  19.   char: inkey, nonstop;
  20.   string: name, datedob, instr, temp_day1, temp_month1;
  21.   int: nameint, nameco, done, this_year, len, temp_day, temp_month;
  22.   int: temp_year,checkno3,checkno4, checkno2;
  23.   struct _stamp:now;
  24.  
  25.   init_lang_cooluser();
  26.   checkno3:=checkfile("cucheck.3");
  27.  
  28.   if (checkno3 = 0)
  29.   {
  30.     remove(str_st_dir_txt + "cucheck.3");
  31.     goto getfull;
  32.   }
  33.  
  34.   checkno4:=checkfile("cucheck.4");
  35.  
  36.   if (checkno4 = 0)
  37.   {
  38.     remove(str_st_dir_txt + "cucheck.4");
  39.     goto getinfo;
  40.   }
  41.   checkno2:=checkfile("cucheck.2");
  42.  
  43.   if (checkno2 = 0)
  44.   {
  45.     remove(str_st_dir_txt + "cucheck.2");
  46.   }
  47.  
  48. getfull:
  49.      print(COL_GRAY, "\n", AVATAR_CLEOL, str_st_menu, str_st_menu_first, ", [", str_st_active_keys, "?", str_st_menu, "] ", str_st_menu_second, " [", str_st_active_keys, "*", str_st_menu, "] " , str_st_menu_third, " : ");
  50.  
  51. getinfo:
  52.     inkey:=getch();
  53.  
  54.     if (inkey = '*')
  55.      {
  56.        remove(str_st_dir_txt + "cucheck.1");
  57.        remove(str_st_dir_txt + "cucheck.2");
  58.        remove(str_st_dir_txt + "cucheck.3");
  59.        remove(str_st_dir_txt + "cucheck.4");
  60.        log(":COOLUSER: "+ str_st_log_end);
  61.        print(str_st_menu_display, "*");
  62.        print(AVATAR_CLS);
  63.        return;
  64.      }
  65.  
  66.     if (inkey = 13)
  67.      {
  68.        goto start;
  69.      }
  70.  
  71.     if (inkey = '?')
  72.       {
  73.         pageheader();
  74.         print(AVATAR_UP);
  75.         display_file(str_st_dir_txt + "cuhelp", nonstop);
  76.         goto start;
  77.       }
  78.  
  79.     if (inkey = 'H' or inkey = 'h')  // Handle
  80.       {
  81.         print(str_st_menu_display, 'H');
  82.         #ifdef handle_opt
  83.           {
  84.             editoption(4, 34, 4, 34, "", 35, '░', str_st_edit);
  85.             name:=inputuser(20);
  86.             nameint:=strtoi(name);
  87.  
  88.             if (strlen(name) = 0)
  89.             {
  90.               goto start;
  91.             }
  92.             log(":COOLUSER: "+ str_st_log_handle);
  93.             usr.alias := name;
  94.             goto start;
  95.           }
  96.         #else
  97.         {
  98.          optionbad();
  99.          goto start;
  100.         }
  101.         #endif
  102.  
  103.    }
  104.  
  105.     if (inkey = 'B' or inkey ='b')   // Date of Birth
  106.       {
  107.         #ifdef birth_opt
  108.           {
  109.            timestamp(now);
  110.            this_year:=now.date.year+1980;
  111.  
  112.            #ifdef USDATE
  113.               datedob := "MM-DD-YY";
  114.            #endif
  115.            #ifdef EUDATE
  116.               datedob := "DD-MM-YY";
  117.            #endif
  118.            #ifdef JPDATE
  119.               datedob := "YY-MM-DD";
  120.            #endif
  121.  
  122.         dobformat:
  123.  
  124.           print(AVATAR_GOTO, (char)8, (char)34);
  125.           print(str_st_edit, padleft("", 10, '░'));
  126.           print(COL_GRAY, "    ", str_st_menu_display, datedob);
  127.           print(AVATAR_GOTO, (char)8,(char)34);
  128.  
  129.            len := input_str(instr, INPUT_NLB_LINE, 0, 10, "");
  130.  
  131.            if(len=0)
  132.             {
  133.                goto start;
  134.             }
  135.             else
  136.  
  137.             log(":COOLUSER: "+ str_st_log_dob);
  138.  
  139.             // Parse all digits
  140.  
  141.             #ifdef EUDATE
  142.               {
  143.                 temp_day:=getdigit(instr);
  144.                 temp_month:=getdigit(instr);
  145.                 temp_year:=getdigit(instr);
  146.               }
  147.             #endif
  148.             #ifdef USDATE
  149.               {
  150.                 temp_month:=getdigit(instr);
  151.                 temp_day:=getdigit(instr);
  152.                 temp_year:=getdigit(instr);
  153.               }
  154.             #endif
  155.             #ifdef JPDATE
  156.               {
  157.                 temp_year:=getdigit(instr);
  158.                 temp_month:=getdigit(instr);
  159.                 temp_day:=getdigit(instr);
  160.               }
  161.             #endif
  162.  
  163.               if (temp_day=0 OR temp_month=0 OR temp_year=0)
  164.                  goto dobformat;
  165.               else
  166.                {
  167.  
  168.                 // Fix year if only two digits entered
  169.  
  170.                 if (temp_year < 100)
  171.                 {
  172.                   temp_year:=temp_year+((this_year/100)*100);
  173.  
  174.                   if (temp_year > this_year)
  175.                     temp_year := temp_year - 100;
  176.                 }
  177.  
  178.                 // Now, validate all fields
  179.  
  180.                if (temp_year <= 1900 or temp_year > (this_year-min_age))
  181.                    {
  182.                      goto dobformat;
  183.                    }
  184.  
  185.                 else
  186.                 {
  187.                   if (temp_month < 1 or temp_month > 12)
  188.                       goto start;
  189.  
  190.                   else if (temp_day < 1 or temp_day > 31)
  191.                       goto start;
  192.  
  193.                   else  // instr ok
  194.                   {
  195.  
  196.                     if (temp_month < 10)
  197.                       {
  198.                         temp_month1 := "0" + itostr(temp_month);
  199.                       }
  200.                     else
  201.                       {
  202.                         temp_month1 := itostr(temp_month);
  203.                       }
  204.  
  205.                     if (temp_day < 10)
  206.                       {
  207.                         temp_day1 := "0" + itostr(temp_day);
  208.                       }
  209.                     else
  210.                       {
  211.                         temp_day1 := itostr(temp_day);
  212.                       }
  213.  
  214.                     // Format the user's DOB as "yyyy.mm.dd"
  215.                     // and store in user record
  216.  
  217.                     usr.dob := itostr(temp_year) + "." +
  218.                               temp_month1 + "." +
  219.                               temp_day1;
  220.                   }
  221.                 }
  222.                }
  223.               goto start;
  224.  
  225.           }
  226.         #else
  227.           {
  228.            print(str_st_menu_display, 'B');
  229.            optionbad();
  230.            goto start;
  231.           }
  232.         #endif
  233.       }
  234.  
  235.     if (inkey = 'X' or inkey ='x')  // Gender
  236.       {
  237.         print(str_st_menu_display, 'X');
  238.         #ifdef gender_opt
  239.          {
  240.          log(":COOLUSER: "+ str_st_log_gender);
  241.          if (usr.sex = 1)
  242.             {
  243.               usr.sex := 2;
  244.               editoption(9, 34, 21, 34, UserSex(usr.sex), 6, ' ', str_st_data_fields);
  245.               goto getfull;
  246.             }
  247.          if (usr.sex = 2)
  248.            {
  249.               usr.sex := 1;
  250.               editoption(9, 34, 21, 34, UserSex(usr.sex), 6, ' ', str_st_data_fields);
  251.               goto getfull;
  252.            }
  253.          if (usr.sex = 0)
  254.            {
  255.               usr.sex := 1;
  256.               editoption(9, 34, 21, 34, UserSex(usr.sex), 6, ' ', str_st_data_fields);
  257.               goto getfull;
  258.            }
  259.          }
  260.         #else
  261.          {
  262.           optionbad();
  263.           goto start;
  264.          }
  265.         #endif
  266.       }
  267.  
  268.     if (inkey = 'L' or inkey ='l') //  Language
  269.       {
  270.         print(str_st_menu_display, 'L');
  271.         #ifdef language_opt
  272.          {
  273.          log(":COOLUSER: "+ str_st_log_lang);
  274.           print(AVATAR_CLS);
  275.           pageheader();
  276.           menu_cmd(616, "");
  277.           goto start;
  278.          }
  279.         #else
  280.          {
  281.         optionbad();
  282.         goto start;
  283.          }
  284.         #endif
  285.       }
  286.  
  287.       if (inkey = 'R' or inkey ='r') // RIP Mode
  288.         {
  289.         #ifdef rip_opt
  290.          {
  291.          log(":COOLUSER: "+ str_st_log_rip);
  292.            if (usr.rip = 0)
  293.              {
  294.              usr.rip := 1;
  295.              editoption(20, 71, 21, 34, Bool(usr.rip), 4, ' ' , str_st_data_fields);
  296.              goto getfull;
  297.              }
  298.            if (usr.rip = 1)
  299.              {
  300.              usr.rip := 0;
  301.              editoption(20, 71, 21, 34, Bool(usr.rip), 4, ' ' , str_st_data_fields);
  302.              goto getfull;
  303.              }
  304.          }
  305.         #else
  306.          {
  307.            print(str_st_menu_display, 'R');
  308.            optionbad();
  309.            goto start;
  310.          }
  311.        #endif
  312.       }
  313.  
  314.     if (inkey = 'F' or inkey ='f') // Help Level
  315.       {
  316.         print(str_st_menu_display, 'F');
  317.        #ifdef help_opt
  318.           {
  319.         log(":COOLUSER: "+ str_st_log_help);
  320.            if (usr.help = 6)
  321.             {
  322.               usr.help := 4;
  323.               editoption(13, 34, 21, 34, HelpLevel(usr.help), 8, ' ' , str_st_data_fields);
  324.               goto getfull;
  325.             }
  326.          if (usr.help = 4)
  327.            {
  328.               usr.help := 2;
  329.               editoption(13, 34, 21, 34, HelpLevel(usr.help), 8, ' ' , str_st_data_fields);
  330.               goto getfull;
  331.            }
  332.          if (usr.help = 2)
  333.            {
  334.               usr.help := 6;
  335.               editoption(13, 34, 21, 34, HelpLevel(usr.help), 8, ' ' , str_st_data_fields);
  336.               goto getfull;
  337.            }
  338.           }
  339.         #else
  340.          {
  341.           optionbad();
  342.           goto start;
  343.          }
  344.         #endif
  345.       }
  346.  
  347.     if (inkey = 'S' or inkey ='s')  // Screen Width
  348.       {
  349.         print(str_st_menu_display, 'S');
  350.         #ifdef scn_width_opt
  351.           {
  352.          log(":COOLUSER: "+ str_st_log_scn_width);
  353.          editoption(16, 34, 16, 34, "", 4, '░' , str_st_edit);
  354.          name:=inputuser(2);
  355.          nameint:=strtoi(name);
  356.  
  357.          if (strlen(name) = 0)
  358.          {
  359.            goto start;
  360.          }
  361.          usr.width := nameint;
  362.          goto start;
  363.           }
  364.         #else
  365.           {
  366.            optionbad();
  367.            goto start;
  368.           }
  369.         #endif
  370.       }
  371.  
  372.      if (inkey = 'U' or inkey ='u')  // Hidden from Userlist
  373.      {
  374.        writeinkey("u");
  375.        return;
  376.      }
  377.  
  378.      if (inkey = 'T' or inkey ='t')  // AVATAR Mode
  379.      {
  380.        writeinkey("t");
  381.        return;
  382.      }
  383.  
  384.      if (inkey = 'E' or inkey = 'e') // Full Screen Msg Editor
  385.      {
  386.        writeinkey("e");
  387.        return;
  388.      }
  389.  
  390.     if (inkey = 'C' or inkey = 'c') // Clear Screen Codes
  391.      {
  392.         print(str_st_menu_display, 'C');
  393.         optionbad();
  394.         goto start;
  395.      }
  396.  
  397.      if (inkey = 'Q' or inkey = 'q')  // Quite Mode
  398.      {
  399.        writeinkey("q");
  400.        return;
  401.      }
  402.  
  403.      if (inkey = 'N' or inkey = 'n')  // ANSI mode
  404.      {
  405.        writeinkey("n");
  406.        return;
  407.      }
  408.  
  409.      if (inkey = 'W' or inkey = 'w')  // Full Screen Msg Viewer
  410.      {
  411.        writeinkey("w");
  412.        return;
  413.      }
  414.      if (inkey = 'G' or inkey = 'g')  // Screen Length
  415.      {
  416.        writeinkey("g");
  417.        return;
  418.      }
  419.      if (inkey = 'M' or inkey = 'm')  // More Prompt
  420.      {
  421.        writeinkey("m");
  422.        return;
  423.      }
  424.      if (inkey = 'K' or inkey = 'k')  // Hot Keys
  425.      {
  426.        writeinkey("k");
  427.        return;
  428.      }
  429.      if (inkey = 'A' or inkey = 'a')  // Default Archiver
  430.      {
  431.        writeinkey("a");
  432.        return;
  433.      }
  434.     if (inkey = 'Z' or inkey = 'z')  // Default Protocol
  435.     {
  436.       writeinkey("z");
  437.       return;
  438.     }
  439.     if (inkey = 'I' or inkey = 'i') // Location
  440.     {
  441.       writeinkey("i");
  442.       return;
  443.     }
  444.     if (inkey = 'V' or inkey = 'v') // Voice/Home Phone
  445.     {
  446.       writeinkey("v");
  447.       return;
  448.     }
  449.     if (inkey = 'D' or inkey = 'd') // Business/ Data Phone
  450.     {
  451.       writeinkey("d");
  452.       return;
  453.     }
  454.     if (inkey = 'P' or inkey = 'p')  // Password
  455.     {
  456.       writeinkey("p");
  457.       return;
  458.     }
  459.  
  460. goto getinfo;
  461.  
  462. start:
  463.  writefile("cucheck.1");    // Display Main Menu
  464. }
  465.  
  466.  
  467. void writeinkey(string: inkey)
  468. {
  469.   int:fd;
  470.  
  471. fd:=open(str_st_dir_txt + "cucheck.2", IOPEN_CREATE | IOPEN_WRITE);
  472.  
  473. writeln(fd, inkey);
  474. close(fd);
  475. }
  476.  
  477.  
  478.